package com.ymh.spring.springmvc.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
// 将类声明为一个控制器组件
@RequestMapping(value = { "/", "/homepage" })
// 将控制器映射到"/"
public class HomeController {

	/**
	 * 
	 * <h4>功能：处理"/"GET请求</h4> <h5>日期：2017年11月8日 下午4:29:08</h5> <h5>作者：Aivin</h5>
	 * 
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET)
	public String home() {
		return "home";// 视图名为home
	}

	@RequestMapping(value = "/${spittleId}", method = RequestMethod.GET)
	public String spittle(@PathVariable(value = "spittleId") long spittleId,
			Model model) {
		return "spittle";
	}

	@RequestMapping(value = "/${spittleId}", method = RequestMethod.GET)
	public String getSpittle(@PathVariable long spittleId,
			Model model) {
		return "spittle";
	}

}
